package test4;


import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

public class DemoPlayer {
	static List<Player> daftar = new ArrayList<Player>();
	public static void main(String[] args)throws Exception{
		
		String[] z = new String[1];
		Player pData = new Player(1,"Harry",190);
		daftar.add(pData);
		pData = new Player(2,"Sally",170);
		daftar.add(pData);
		pData = new Player(3,"John",85);
		daftar.add(pData);
		pData = new Player(4,"Bond",60);
		daftar.add(pData);
		
//		for(Object a : daftar){
//			System.out.println(a);
//			
//		}
		//Person myLocatedObject = myList.Find(delegate(Person p) {return p.ID == 1; });
		//System.out.println(daftar.get(0).getId());
		layar();
//		System.out.println("Menu");
//		System.out.println("(x) Exit");
//		System.out.println("(c) Clear List");
//		System.out.println("(a) Add New Player");
//		for(int i=0 ; i<daftar.size() ; i++){
//			System.out.println("(" + daftar.get(i).getId() + ") " + daftar.get(i).getName());
//		}
//		System.out.print("Choose/Add player: ");
//		BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
//		String menu = bf.readLine();
//		
//		if(menu.equals("x")){
//			System.exit(0);
//		}
//		else if(menu.equals("1")){
//			System.out.println("Enter new score: ");
//			BufferedReader bf1 = new BufferedReader(new InputStreamReader(System.in));
//			int score = Integer.parseInt(bf1.readLine());
//			daftar.get(1).setScore(score);
//		}
//		else if(menu.equals("2")){
//			System.out.println("Enter new score: ");
//			BufferedReader bf1 = new BufferedReader(new InputStreamReader(System.in));
//			int pilih = Integer.parseInt(bf1.readLine());
//		}
//		else if(menu.equals("3")){
//			System.out.println("Enter new score: ");
//			BufferedReader bf1 = new BufferedReader(new InputStreamReader(System.in));
//			int pilih = Integer.parseInt(bf1.readLine());
//		}
//		else if(menu.equals("4")){
//			System.out.println("Enter new score: ");
//			BufferedReader bf1 = new BufferedReader(new InputStreamReader(System.in));
//			int pilih = Integer.parseInt(bf1.readLine());
//		}
		
	}
	
	public static void layar() throws Exception{
		for(Object a : daftar){
			System.out.println(a);
			
		}
		System.out.println("Menu");
		System.out.println("(x) Exit");
		System.out.println("(c) Clear List");
		System.out.println("(a) Add New Player");
		for(int i=0 ; i<daftar.size() ; i++){
			System.out.println("(" + daftar.get(i).getId() + ") " + daftar.get(i).getName());
		}
		System.out.print("Choose/Add player: ");
		BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
		String menu = bf.readLine();
		
		if(menu.equals("x")){
			System.exit(0);
		}
		else if(menu.equals("1")){
			System.out.println("Enter new score: ");
			BufferedReader bf1 = new BufferedReader(new InputStreamReader(System.in));
			int score = Integer.parseInt(bf1.readLine());
			daftar.get(0).setScore(score);
			layar();
		}
		else if(menu.equals("2")){
			System.out.println("Enter new score: ");
			BufferedReader bf1 = new BufferedReader(new InputStreamReader(System.in));
			int pilih = Integer.parseInt(bf1.readLine());
		}
		else if(menu.equals("3")){
			System.out.println("Enter new score: ");
			BufferedReader bf1 = new BufferedReader(new InputStreamReader(System.in));
			int pilih = Integer.parseInt(bf1.readLine());
		}
		else if(menu.equals("4")){
			System.out.println("Enter new score: ");
			BufferedReader bf1 = new BufferedReader(new InputStreamReader(System.in));
			int pilih = Integer.parseInt(bf1.readLine());
		}
	}
	
}